<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<import type="js" file="js.jquery" />
<import type="js" file="js.common" />
<import type="css" file="css.global" />
<import type="css" file="css.form" />
</head>
<body>
<div class="search">
<input type="button" value="添加" class="button" onclick="add()" >
</div>
<div class="list">
<table class="stripe" cellspacing="0">
    <thead>
        <tr>
            <th style="min-width: 30px;"><input type="checkbox" name="checkid" onclick="if(this.checked==true) { checkAll('key[]'); } else { clearAll('key[]'); }" ></th>
            <th width="5%">序号</th>
            <th width="20%">名称</th>
            <th width="20%">显示名</th>
            <th width="20%">分组</th>
            <th width="9%">启用状态</th>
            <th width="9%">连接启用</th>
            <th width="15%">操作</th>
        </tr>
    </thead>
 
    <tbody>
      <volist name="data" id="vo">
        <tr>
            <td><input type="checkbox" name="key[]" value="{$vo.menu_id}"></td>
            <td>{$vo.menu_id}</td>
            <td>{$vo.action}</td>
            <td>{$vo.menu_name}</td>
            <td>{$vo.menu_name}</td>
            <td><if condition="$vo['status'] eq '1'"><a href="javascript:void(0);" onclick="disablestatus({$vo.menu_id},0)" class="enable" title="点击禁用">启用</a><else /><a href="javascript:void(0);" onclick="disablestatus({$vo.menu_id},1)" class="disable" style="color: red;" title="点击启用">禁用</a></if></td>
            <td><if condition="$vo['type'] eq 1"><a href="javascript:void(0);" onclick="disabletype({$vo.menu_id},0)" class="enable" title="点击禁用">启用</a><else /><a href="javascript:void(0);" onclick="disabletype({$vo.menu_id},1)" class="disable" style="color: red;" title="点击启用">禁用</a></if></td>
            <td><a href="javascript:void(0);" class="edit" onclick="edit({$vo.menu_id});" >编辑</a>  |  <a href="javascript:void(0);" class="del" onclick="del({$vo.menu_id})">删除</a></td>
        </tr>
      </volist>
    </tbody>
</table>
</div>
</body>
</html>
<script language="javascript">
$(document).ready(function(){  
	$(".stripe tr").mouseover(function(){    
	  $(this).addClass("over");}).mouseout(function(){   
			$(this).removeClass("over");}) 
  	$(".stripe tr:even").addClass("alt");
});   
function add(){
	window.location="__APP__/Menu/add";
}
function edit(id){
	window.location="__APP__/Menu/edit?menu_id="+id;
}
function del(id){
	if (confirm("真的要删除吗？")){
		$.get("__APP__/Menu/delete?menu_id="+id,function(result){
			location.reload();
		});
	}else{
		return false;
	}
}
function disablestatus(id, val){
	if(val == '1'){ 
		var msg = "确定要启用么？";
	}else if(val == '0'){
		var msg = "确定要禁用么？";
	}
	if (confirm(msg)){
		$.get("__APP__/Menu/status_disable?menu_id="+id+"&val="+val,function(result){
			location.reload();
		});
	}else{
		return false;
	}
}

function disabletype(id, val){
	if(val == '1'){ 
		var msg = "确定要启用么？";
	}else if(val == '0'){
		var msg = "确定要禁用么？";
	}
	if (confirm(msg)){
		$.get("__APP__/Menu/type_disable?menu_id="+id+"&val="+val,function(result){
			location.reload();
		});
	}else{
		return false;
	}
}
</script>  